<?php 
	// pr($imports);
	pr(split("_", $imports[0]["Attach"]["original_name"]));
?>
<div class="row-fluid">
	<div class="span2"></div>
	<div class="span8">
		<form action="<?php echo $this->webroot;?>Uploadimport/upload" method='post' enctype='multipart/form-data'>
		    <p class="lead text-center demo-panel-title"><?php echo __("Upload form"); ?></p>
			<div class="attach-form">
			    <div class="control-group">
				    <input type="hidden" value="IMPORT" name="attachTipo" >
					<input type='file' name='attach[]' multiple="multiple"  />
			        <button type="submit" class="btn btn-default btn-block" ><?php echo __("UPLOAD"); ?></button>
			    </div>
			</div>
		</form>
	</div>
	<div class="span2"></div>
</div>
<div class="row-fluid">
	<div class="span2"></div>
	<div class="span8">
	    <p class="lead text-center demo-panel-title"><?php echo __("Files importati o da importare"); ?></p>
        <?php if (count($imports)>0) { ?>
            <table class="table table-hover">
	              <thead>
	                <tr>
	                  <th></th>
	                  <th><?php echo __("filename"); ?></th>
	                  <th><?php echo __("dimensione"); ?></th>
	                  <th><?php echo __("utente inserimento"); ?></th>
	                  <th><?php echo __("data inserimento"); ?></th>
	                  <th><?php echo __("data import"); ?></th>
	                  <th><?php echo __("stato"); ?></th>
	                  <th><?php echo __("errore"); ?></th>
	                  <th></th>
	                </tr>
	              </thead>
	              <tbody>
	                  <? foreach ($imports as $key => $import) { ?>
		              	<tr>
		                  <td>
							<?php if ($this->Permission->check("controllers/Import/execute") && $import["Import"]["status"]!=IMPORT_STATUS_IMPORTED) {
		                  		echo $this->Acl->link("<i class='icon-th'></i>",array("controller" => "Import", "action" => "execute", $import["Import"]["type"], $import["Import"]["id"]), array('class'=>'btn','escape'=>false)); 
		                  	 } ?> 
		                  </td>
		                  <td><?php echo $import["Attach"]["original_name"]; ?></td>
		                  <td><?php echo $import["Attach"]["dimensione"]; ?></td>
		                  <td><?php echo $import["Attach"]["ut_ins"]; ?></td>
		                  <td><?php echo $import["Attach"]["dt_ins"]; ?></td>
		                  <td><?php echo $import["Import"]["dt_import"]; ?></td>
		                  <td><?php echo __(Import::$STATUS[$import["Import"]["status"]]); ?></td>
		                  <td><?php echo $import["Import"]["error"]; ?></td>
		                  <td><?php echo $this->Acl->link("<i class='icon-trash'></i>",array("controller" => "Import", "action" => "delete", $import["Import"]["id"]), array('data-confirm'=>'true','class'=>'btn','escape'=>false));  ?> </td>
		                </tr>
    					<?php } ?>
	              </tbody>
	        </table>  
        <?php }else{ ?>
                <label class="text-center"><i class="icon-frown"></i> Non ci sono file da importare.</label>       
        <?php }?>
	</div>
	<div class="span2"></div>
</div>